import 'package:du_application/model/IndexModel.dart';

class GoodsModel {
  int errno;
  Data data;
  String errmsg;

  GoodsModel({this.errno, this.data, this.errmsg});

  GoodsModel.fromJson(Map<String, dynamic> json) {
    errno = json['errno'];
    data = json['data'] != null ? new Data.fromJson(json['data']) : null;
    errmsg = json['errmsg'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['errno'] = this.errno;
    if (this.data != null) {
      data['data'] = this.data.toJson();
    }
    data['errmsg'] = this.errmsg;
    return data;
  }
}
class ForGoods {
	int id;
	String name;
	String brief;
	String picUrl;
	bool isNew;
	bool isHot;
	double counterPrice;
	double retailPrice;

	ForGoods({this.id, this.name, this.brief, this.picUrl, this.isNew, this.isHot, this.counterPrice, this.retailPrice});

	ForGoods.fromJson(Map<String, dynamic> json) {
		id = json['id'];
		name = json['name'];
		brief = json['brief'];
		picUrl = json['picUrl'];
		isNew = json['isNew'];
		isHot = json['isHot'];
		counterPrice = json['counterPrice'];
		retailPrice = json['retailPrice'];
	}

	Map<String, dynamic> toJson() {
		final Map<String, dynamic> data = new Map<String, dynamic>();
		data['id'] = this.id;
		data['name'] = this.name;
		data['brief'] = this.brief;
		data['picUrl'] = this.picUrl;
		data['isNew'] = this.isNew;
		data['isHot'] = this.isHot;
		data['counterPrice'] = this.counterPrice;
		data['retailPrice'] = this.retailPrice;
		return data;
	}
}
class Data {
  List<GoodsList> goodsList;
  List<SpecificationList> specificationList;
  List<Null> groupon;
  List<Issue> issue;
  int userHasCollect;
  String shareImage;
  Comment comment;
  bool share;
  List<Attribute> attribute;
  Brand brand;
  List<ProductList> productList;
  Info info;
  List<ForGoods> forGoods;
   AffairShow affairShow;
  Data(
      {this.specificationList,
      this.groupon,
      this.issue,
      this.userHasCollect,
      this.shareImage,
      this.comment,
      this.affairShow,
      this.share,
      this.attribute,
      this.brand,
      this.productList,
      this.info});

  Data.fromJson(Map<String, dynamic> json) {
         affairShow = json['affairShow'] != null
        ? new AffairShow.fromJson(json['affairShow'])
        : null;
    if (json['specificationList'] != null) {
      specificationList = new List<SpecificationList>();
      json['specificationList'].forEach((v) {
        specificationList.add(new SpecificationList.fromJson(v));
      });
    }
    
    if (json['groupon'] != null) {
      groupon = new List<Null>();
      json['groupon'].forEach((v) {
      
      });
    }
    if (json['issue'] != null) {
      issue = new List<Issue>();
      json['issue'].forEach((v) {
        issue.add(new Issue.fromJson(v));
      });
    }

    userHasCollect = json['userHasCollect'];
    shareImage = json['shareImage'];
    comment =
        json['comment'] != null ? new Comment.fromJson(json['comment']) : null;
    share = json['share'];
    if (json['attribute'] != null) {
      attribute = new List<Attribute>();
      json['attribute'].forEach((v) {
        attribute.add(new Attribute.fromJson(v));
      });
    }
   if (json['forGoods'] != null) {
			forGoods = new List<ForGoods>();
			json['forGoods'].forEach((v) { forGoods.add(new ForGoods.fromJson(v)); });
		}
    brand = json['brand'] != null ? new Brand.fromJson(json['brand']) : null;
    if (json['productList'] != null) {
      productList = new List<ProductList>();
      json['productList'].forEach((v) {
        productList.add(new ProductList.fromJson(v));
      });
    }
       if (json['goodsList'] != null) {
      goodsList = new List<GoodsList>();
      json['goodsList'].forEach((v) {
        goodsList.add(new GoodsList.fromJson(v));
      });
    }
    info = json['info'] != null ? new Info.fromJson(json['info']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.specificationList != null) {
      data['specificationList'] =
          this.specificationList.map((v) => v.toJson()).toList();
    }
     if (this.goodsList != null) {
      data['goodsList'] = this.goodsList.map((v) => v.toJson()).toList();
    }
    	if (this.forGoods != null) {
      data['forGoods'] = this.forGoods.map((v) => v.toJson()).toList();
    }
    if (this.groupon != null) {
   
    }
    if (this.issue != null) {
      data['issue'] = this.issue.map((v) => v.toJson()).toList();
    }
    data['userHasCollect'] = this.userHasCollect;
    data['shareImage'] = this.shareImage;
    if (this.comment != null) {
      data['comment'] = this.comment.toJson();
    }
    data['share'] = this.share;
    if (this.attribute != null) {
      data['attribute'] = this.attribute.map((v) => v.toJson()).toList();
    }
    if (this.brand != null) {
      data['brand'] = this.brand.toJson();
    }
    if (this.productList != null) {
      data['productList'] = this.productList.map((v) => v.toJson()).toList();
    }
    if (this.info != null) {
      data['info'] = this.info.toJson();
    }
     if (this.affairShow != null) {
      data['affairShow'] = this.affairShow.toJson();
    }
    return data;
  }
}
class AffairShow {
  int total;
  int pages;
  int limit;
  int page;
  List<Affairs> affairs;

  AffairShow({this.total, this.pages, this.limit, this.page, this.affairs});

  AffairShow.fromJson(Map<String, dynamic> json) {
    total = json['total'];
    pages = json['pages'];
    limit = json['limit'];
    page = json['page'];
    if (json['affairs'] != null) {
      affairs = new List<Affairs>();
      json['affairs'].forEach((v) {
        affairs.add(new Affairs.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['total'] = this.total;
    data['pages'] = this.pages;
    data['limit'] = this.limit;
    data['page'] = this.page;
    if (this.affairs != null) {
      data['affairs'] = this.affairs.map((v) => v.toJson()).toList();
    }
    return data;
  }
}

class Affairs {
  UserInfo userInfo;
  Affair affair;

  Affairs({this.userInfo, this.affair});

  Affairs.fromJson(Map<String, dynamic> json) {
    userInfo = json['userInfo'] != null
        ? new UserInfo.fromJson(json['userInfo'])
        : null;
    affair =
        json['affair'] != null ? new Affair.fromJson(json['affair']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.userInfo != null) {
      data['userInfo'] = this.userInfo.toJson();
    }
    if (this.affair != null) {
      data['affair'] = this.affair.toJson();
    }
    return data;
  }
}

class UserInfo {
  String nickName;
  String avatarUrl;

  UserInfo({this.nickName, this.avatarUrl});

  UserInfo.fromJson(Map<String, dynamic> json) {
    nickName = json['nickName'];
    avatarUrl = json['avatarUrl'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['nickName'] = this.nickName;
    data['avatarUrl'] = this.avatarUrl;
    return data;
  }
}

class Affair {
  int id;
  bool isGoods;
  bool deleted;
  int goodsId;
  int status;
  int userId;
  String addTime;
  String updateTime;
  String content;
  String url;

  Affair(
      {this.id,
      this.isGoods,
      this.deleted,
      this.goodsId,
      this.status,
      this.userId,
      this.addTime,
      this.updateTime,
      this.content,
      this.url});

  Affair.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    isGoods = json['isGoods'];
    deleted = json['deleted'];
    goodsId = json['goodsId'];
    status = json['status'];
    userId = json['userId'];
    addTime = json['addTime'];
    updateTime = json['updateTime'];
    content = json['content'];
    url = json['url'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['isGoods'] = this.isGoods;
    data['deleted'] = this.deleted;
    data['goodsId'] = this.goodsId;
    data['status'] = this.status;
    data['userId'] = this.userId;
    data['addTime'] = this.addTime;
    data['updateTime'] = this.updateTime;
    data['content'] = this.content;
    data['url'] = this.url;
    return data;
  }
}
class SpecificationList {
  String name;
  List<ValueList> valueList;

  SpecificationList({this.name, this.valueList});

  SpecificationList.fromJson(Map<String, dynamic> json) {
    name = json['name'];
    if (json['valueList'] != null) {
      valueList = new List<ValueList>();
      json['valueList'].forEach((v) {
        valueList.add(new ValueList.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['name'] = this.name;
    if (this.valueList != null) {
      data['valueList'] = this.valueList.map((v) => v.toJson()).toList();
    }
    return data;
  }
}
  
class ValueList {
  int id;
  int goodsId;
  String specification;
  String value;
  String picUrl;
  String addTime;
  String updateTime;
  bool deleted;

  ValueList(
      {this.id,
      this.goodsId,
      this.specification,
      this.value,
      this.picUrl,
      this.addTime,
      this.updateTime,
      this.deleted});

  ValueList.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    goodsId = json['goodsId'];
    specification = json['specification'];
    value = json['value'];
    picUrl = json['picUrl'];
    addTime = json['addTime'];
    updateTime = json['updateTime'];
    deleted = json['deleted'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['goodsId'] = this.goodsId;
    data['specification'] = this.specification;
    data['value'] = this.value;
    data['picUrl'] = this.picUrl;
    data['addTime'] = this.addTime;
    data['updateTime'] = this.updateTime;
    data['deleted'] = this.deleted;
    return data;
  }
}

class Issue {
  int id;
  String question;
  String answer;
  String addTime;
  String updateTime;
  bool deleted;

  Issue(
      {this.id,
      this.question,
      this.answer,
      this.addTime,
      this.updateTime,
      this.deleted});

  Issue.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    question = json['question'];
    answer = json['answer'];
    addTime = json['addTime'];
    updateTime = json['updateTime'];
    deleted = json['deleted'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['question'] = this.question;
    data['answer'] = this.answer;
    data['addTime'] = this.addTime;
    data['updateTime'] = this.updateTime;
    data['deleted'] = this.deleted;
    return data;
  }
}

class Comment {
  List<CommentSize> commentSize;
  int count;

  Comment({this.commentSize, this.count});

  Comment.fromJson(Map<String, dynamic> json) {
    if (json['commentSize'] != null) {
      commentSize = new List<CommentSize>();
      json['commentSize'].forEach((v) {
        commentSize.add(new CommentSize.fromJson(v));
      });
    }
    count = json['count'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.commentSize != null) {
      data['commentSize'] = this.commentSize.map((v) => v.toJson()).toList();
    }
    data['count'] = this.count;
    return data;
  }
}

class CommentSize {
  int small;
  int big;
  int yes;

  CommentSize({this.small, this.big, this.yes});

  CommentSize.fromJson(Map<String, dynamic> json) {
    small = json['small'];
    big = json['big'];
    yes = json['yes'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['small'] = this.small;
    data['big'] = this.big;
    data['yes'] = this.yes;
    return data;
  }
}

class Attribute {
  int id;
  int goodsId;
  String attribute;
  String value;
  String addTime;
  String updateTime;
  bool deleted;

  Attribute(
      {this.id,
      this.goodsId,
      this.attribute,
      this.value,
      this.addTime,
      this.updateTime,
      this.deleted});

  Attribute.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    goodsId = json['goodsId'];
    attribute = json['attribute'];
    value = json['value'];
    addTime = json['addTime'];
    updateTime = json['updateTime'];
    deleted = json['deleted'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['goodsId'] = this.goodsId;
    data['attribute'] = this.attribute;
    data['value'] = this.value;
    data['addTime'] = this.addTime;
    data['updateTime'] = this.updateTime;
    data['deleted'] = this.deleted;
    return data;
  }
}

class Brand {
  int id;
  String name;
  String desc;
  String picUrl;
  int sortOrder;
  double floorPrice;
  String addTime;
  String updateTime;
  bool deleted;

  Brand(
      {this.id,
      this.name,
      this.desc,
      this.picUrl,
      this.sortOrder,
      this.floorPrice,
      this.addTime,
      this.updateTime,
      this.deleted});

  Brand.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    desc = json['desc'];
    picUrl = json['picUrl'];
    sortOrder = json['sortOrder'];
    floorPrice = json['floorPrice'];
    addTime = json['addTime'];
    updateTime = json['updateTime'];
    deleted = json['deleted'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    data['desc'] = this.desc;
    data['picUrl'] = this.picUrl;
    data['sortOrder'] = this.sortOrder;
    data['floorPrice'] = this.floorPrice;
    data['addTime'] = this.addTime;
    data['updateTime'] = this.updateTime;
    data['deleted'] = this.deleted;
    return data;
  }
}

class ProductList {
  int id;
  int goodsId;
  List<String> specifications;
  double price;
  int number;
  String url;
  String addTime;
  String updateTime;


  ProductList(
      {this.id,
      this.goodsId,
      this.specifications,
      this.price,
      this.number,
      this.url,
      this.addTime,
      this.updateTime});

  ProductList.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    goodsId = json['goodsId'];
    specifications = json['specifications'].cast<String>();
    price = json['price'];
    number = json['number'];
    url = json['url'];
    addTime = json['addTime'];
    updateTime = json['updateTime'];

  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['goodsId'] = this.goodsId;
    data['specifications'] = this.specifications;
    data['price'] = this.price;
    data['number'] = this.number;
    data['url'] = this.url;
    data['addTime'] = this.addTime;
    data['updateTime'] = this.updateTime;
  
    return data;
  }
}

class Info {
  int id;
  String goodsSn;
  String name;
  int categoryId;
  int brandId;
  List<String> gallery;
  String keywords;
  String brief;
  bool isOnSale;
  int sortOrder;
  String picUrl;
  String shareUrl;
  bool isNew;
  bool isHot;
  String unit;
  double counterPrice;
  double retailPrice;
  String addTime;
  String updateTime;
  bool deleted;
  String detail;

  Info(
      {this.id,
      this.goodsSn,
      this.name,
      this.categoryId,
      this.brandId,
      this.gallery,
      this.keywords,
      this.brief,
      this.isOnSale,
      this.sortOrder,
      this.picUrl,
      this.shareUrl,
      this.isNew,
      this.isHot,
      this.unit,
      this.counterPrice,
      this.retailPrice,
      this.addTime,
      this.updateTime,
      this.deleted,
      this.detail});

  Info.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    goodsSn = json['goodsSn'];
    name = json['name'];
    categoryId = json['categoryId'];
    brandId = json['brandId'];
    gallery = json['gallery'].cast<String>();
    keywords = json['keywords'];
    brief = json['brief'];
    isOnSale = json['isOnSale'];
    sortOrder = json['sortOrder'];
    picUrl = json['picUrl'];
    shareUrl = json['shareUrl'];
    isNew = json['isNew'];
    isHot = json['isHot'];
    unit = json['unit'];
    counterPrice = json['counterPrice'];
    retailPrice = json['retailPrice'];
    addTime = json['addTime'];
    updateTime = json['updateTime'];
    deleted = json['deleted'];
    detail = json['detail'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['goodsSn'] = this.goodsSn;
    data['name'] = this.name;
    data['categoryId'] = this.categoryId;
    data['brandId'] = this.brandId;
    data['gallery'] = this.gallery;
    data['keywords'] = this.keywords;
    data['brief'] = this.brief;
    data['isOnSale'] = this.isOnSale;
    data['sortOrder'] = this.sortOrder;
    data['picUrl'] = this.picUrl;
    data['shareUrl'] = this.shareUrl;
    data['isNew'] = this.isNew;
    data['isHot'] = this.isHot;
    data['unit'] = this.unit;
    data['counterPrice'] = this.counterPrice;
    data['retailPrice'] = this.retailPrice;
    data['addTime'] = this.addTime;
    data['updateTime'] = this.updateTime;
    data['deleted'] = this.deleted;
    data['detail'] = this.detail;
    return data;
  }
}